package com.xjrsoft.module.customer.erp_model.salesOrder.vo;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import com.xjrsoft.common.Enum.TransDataType;
import com.xjrsoft.common.annotation.DataTrans;
import io.swagger.annotations.ApiModel;

/**
 * 视图实体类
 *
 * @author pp
 * @since 2021-09-26
 */
@Data
@ApiModel(value = "列表ErpSalesorderVo对象", description = "列表ErpSalesorderVo对象")
public class ErpSalesorderListVo {

    @JsonProperty("F_Id")
    private String fId;

    @JsonProperty("F_SalesCode")
    private String fSalescode;

    @JsonProperty("F_Orderdate")
    private LocalDateTime fOrderdate;

    @JsonProperty("F_DeliveryDate")
    private LocalDateTime fDeliverydate;

    @JsonProperty("F_ClientId")
    @DataTrans(dataType = TransDataType.DATA_SQL, dataCode = "localDB", sql = "select t.F_Id,t.F_FullName from erp_inoutunit t where t.F_UniType=2", savedField = "F_Id", showField = "F_FullName", multi = false)
    private String fClientid;

    @JsonProperty("F_SalesType")
    @DataTrans(dataType = TransDataType.DATA_ITEM, dataCode = "销售类型", multi = false)
    private String fSalestype;

    @JsonProperty("F_SalesPersonId")
    private String fSalespersonid;

    @JsonProperty("F_PaymentMethod")
    @DataTrans(dataType = TransDataType.DATA_ITEM, dataCode = "Client_PaymentMode", multi = false)
    private String fPaymentmethod;

    @JsonProperty("F_PaymentPeriod")
    private LocalDateTime fPaymentperiod;

    @JsonProperty("F_IsInvoice")
    @DataTrans(dataType = TransDataType.DATA_ITEM, dataCode = "YesOrNo", multi = true)
    private String fIsinvoice;

    @JsonProperty("F_Discount")
    private String fDiscount;

    @JsonProperty("F_DiscountedPrice")
    private BigDecimal fDiscountedprice;

    @JsonProperty("F_Turnover")
    private BigDecimal fTurnover;

    @JsonProperty("F_Description")
    private String fDescription;

    @JsonProperty("F_CreatorUserId")
    @DataTrans(dataType = TransDataType.USER, multi = false)
    private String fCreatoruserid;

    @JsonProperty("F_CreatorTime")
    private LocalDateTime fCreatortime;

    @JsonProperty("F_AuditMark")
    private String fAuditmark;

    @JsonProperty("F_InvalidMark")
    private String fInvalidmark;


    @JsonProperty("flowStatus")
    private String flowStatus;

    @JsonProperty("nwfSchemeinfoId")
    private String nwfSchemeinfoId;

    @JsonProperty("formId")
    private String formId;

    //返回的值
    @JsonProperty("F_Status")
    private String fStatusName;

    //没有转换之前的值
    @JsonIgnore
    private Integer fStatus;
    //转换方法
    public String getfStatusName() {
        String name = null;
        if(this.fStatus!=null){
            switch (this.fStatus) {
                case 1 :
                    name = "未出库";
                    break;
                case 2:
                    name = "已出库";
                    break;
                case 0:
                    name="部分出库";
                    break;
            }
        }
        return name;
    }
}
